/*******************************************************************************
 * Copyright (c) 2012, 2013 XML-Print Project.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     XML-Print Project - initial API and implementation
 ******************************************************************************/
package info.xmlprint;

import org.eclipse.jface.action.ICoolBarManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarContributionItem;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

/**
 * An action bar advisor is responsible for creating, adding, and disposing of
 * the actions added to a workbench window. Each window will be populated with
 * new actions.
 */
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
		super(configurer);
	}

	protected void makeActions(final IWorkbenchWindow window) {
		// ActionManager actionManager = ActionManager.getInstance();
		// exitAction = ActionFactory.QUIT.create(window);
		// register(exitAction);
		// actionManager.add(exitAction);

		// aboutAction = ActionFactory.ABOUT.create(window);
		// register(aboutAction);
		// actionManager.add(aboutAction);

		// newProjectAction = new WizardNewProject();
		// register(newProjectAction);
		// actionManager.add(newProjectAction);

		// openAction = new OpenFile();
		// register(openAction);
		// actionManager.add(openAction);

		// saveAction = new SaveFile();
		// register(saveAction);
		// actionManager.add(saveAction);
		// saveAction.setEnabled(false);

		// saveAsPDFAction = new SaveAsPDF();
		// register(saveAsPDFAction);
		// actionManager.add(saveAsPDFAction);
		// saveAsPDFAction.setEnabled(false);

		// saveAsXMLPAction = new SaveAsXMLP();
		// register(saveAsXMLPAction);
		// actionManager.add(saveAsXMLPAction);
		// saveAsXMLPAction.setEnabled(false);

		// setupAction = new Setup();
		// //register(setupAction);
		// actionManager.add(setupAction);

		// pdfPreviewAction = new PDFPreview();
		// register(pdfPreviewAction);
		// actionManager.add(pdfPreviewAction);
		// pdfPreviewAction.setEnabled(false);

		// resultTextAction = new ResultText();
		// register(resultTextAction);
		// actionManager.add(resultTextAction);
		// resultTextAction.setEnabled(false);

		// openStileditorAction = new Stileditor();
		// register(openStileditorAction);
		// actionManager.add(openStileditorAction);
		// openStileditorAction.setEnabled(false);
	}

	protected void fillMenuBar(IMenuManager menuBar) {
		// File Menu
		// MenuManager fileMenu = new MenuManager("&File", "File");
		// menuBar.add(fileMenu);

		// fileMenu.add(newProjectAction);
		// fileMenu.add(openAction);
		// fileMenu.add(saveAction);

		// fileMenu.add(new Separator());

		// MenuManager exportSubMenu = new MenuManager("&Export",
		// Activator.getImageDescriptor("/icons/export.gif"), "Export");
		// exportSubMenu.add(saveAsPDFAction);
		// exportSubMenu.add(saveAsXMLPAction);
		// fileMenu.add(exportSubMenu);

		// fileMenu.add(new Separator());
		// fileMenu.add(exitAction);

		// Print Menu
		// MenuManager printMenu = new MenuManager("&Print", "Print");
		// menuBar.add(printMenu);
		// printMenu.add(pdfPreviewAction);
		// printMenu.add(resultTextAction);
		// printMenu.add(openStileditorAction);
		// printMenu.add(new Separator());
		// printMenu.add(setupAction);
		// Help Menu
		// MenuManager helpMenu = new MenuManager("&Help",
		// IWorkbenchActionConstants.M_HELP);
		// helpMenu.add(aboutAction);
		// menuBar.add(helpMenu);
	}

	protected void fillCoolBar(ICoolBarManager coolBar) {
		IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
		toolbar.add(new Separator());
		coolBar.add(new ToolBarContributionItem(toolbar, "xmlprint.placeholder"));//$NON-NLS-1$
		toolbar.add(new Separator());
	}
}
